<!DOCTYPE html>












  


<html class="theme-next pisces use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">








  <meta http-equiv="Cache-Control" content="no-transform">
  <meta http-equiv="Cache-Control" content="no-siteapp">














  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext">
  






<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2">

<link rel="stylesheet" href="/css/main.css?v=7.1.2">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png?v=7.1.2">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png?v=7.1.2">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png?v=7.1.2">


  <link rel="mask-icon" href="/images/safari-pinned-tab.svg?v=7.1.2" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '7.1.2',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false,"dimmer":false},
    back2top: true,
    back2top_sidebar: true,
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":true,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="vim配置目录结构1234567.├── .vimrc└── .vim    ├── autoload    │   └── plug.vim    └── plugged        └── ...   .vimrc vim的配置文件 .vim   存放插件主题等资源的文件夹 autoload 存放插件  plugged 使用plug插件管理器安装的插件目录">
<meta name="keywords" content="Linux,C&#x2F;C++,Vim">
<meta property="og:type" content="article">
<meta property="og:title" content="Vim配置C&#x2F;C++语言开发环境">
<meta property="og:url" content="https://www.inetdev.cn/post/f767db5f.html">
<meta property="og:site_name" content="万物更新, 旧疾当愈">
<meta property="og:description" content="vim配置目录结构1234567.├── .vimrc└── .vim    ├── autoload    │   └── plug.vim    └── plugged        └── ...   .vimrc vim的配置文件 .vim   存放插件主题等资源的文件夹 autoload 存放插件  plugged 使用plug插件管理器安装的插件目录">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://182.61.20.108/images/vim-config/vim1.png">
<meta property="og:updated_time" content="2019-06-17T03:22:44.864Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Vim配置C&#x2F;C++语言开发环境">
<meta name="twitter:description" content="vim配置目录结构1234567.├── .vimrc└── .vim    ├── autoload    │   └── plug.vim    └── plugged        └── ...   .vimrc vim的配置文件 .vim   存放插件主题等资源的文件夹 autoload 存放插件  plugged 使用plug插件管理器安装的插件目录">
<meta name="twitter:image" content="http://182.61.20.108/images/vim-config/vim1.png">





  
  
  <link rel="canonical" href="https://www.inetdev.cn/post/f767db5f">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>Vim配置C/C++语言开发环境 | 万物更新, 旧疾当愈</title>
  












  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">万物更新, 旧疾当愈</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <h1 class="site-subtitle" itemprop="description">这是一个备忘录，没错，备忘录。</h1>
      
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
    
      
    

    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
    
      
    

    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
    
      
    

    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>

      
      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
        </li>
      
    </ul>
  

  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  
    <div class="reading-progress-bar"></div>
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://www.inetdev.cn/post/f767db5f.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="XiaNing">
      <meta itemprop="description" content="这里放点东西比较和谐。">
      <meta itemprop="image" content="/images/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="万物更新, 旧疾当愈">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">Vim配置C/C++语言开发环境

              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-04-26 02:07:18" itemprop="dateCreated datePublished" datetime="2019-04-26T02:07:18+08:00">2019-04-26</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2019-06-17 11:22:44" itemprop="dateModified" datetime="2019-06-17T11:22:44+08:00">2019-06-17</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/Linux/" itemprop="url" rel="index"><span itemprop="name">Linux</span></a></span>

                
                
                  ，
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/Linux/C-C/" itemprop="url" rel="index"><span itemprop="name">C/C++</span></a></span>

                
                
                  ，
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/Linux/Vim/" itemprop="url" rel="index"><span itemprop="name">Vim</span></a></span>

                
                
              
            </span>
          

          
            
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon">
            <i class="fa fa-eye"></i>
             阅读次数： 
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="vim配置目录结构"><a href="#vim配置目录结构" class="headerlink" title="vim配置目录结构"></a>vim配置目录结构</h2><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">.</span><br><span class="line">├── .vimrc</span><br><span class="line">└── .vim</span><br><span class="line">    ├── <span class="built_in">autoload</span></span><br><span class="line">    │   └── plug.vim</span><br><span class="line">    └── plugged</span><br><span class="line">        └── ...</span><br></pre></td></tr></table></figure>

<ul>
<li>.vimrc vim的配置文件</li>
<li>.vim   存放插件主题等资源的文件夹</li>
<li>autoload 存放插件 </li>
<li>plugged 使用plug插件管理器安装的插件目录<a id="more"></a>

</li>
</ul>
<h2 id="vim主题"><a href="#vim主题" class="headerlink" title="vim主题"></a>vim主题</h2><p><img src="http://182.61.20.108/images/vim-config/vim1.png" alt="vim-color-scheme-dog"></p>
<ul>
<li>自己做的一个主题, 合适, 看着顺眼最重要</li>
<li>下载地址 <a href="https://github.com/xia-ning/vim-colorscheme-dog" target="_blank" rel="noopener">https://github.com/xia-ning/vim-colorscheme-dog</a></li>
</ul>
<h2 id="vimrc"><a href="#vimrc" class="headerlink" title=".vimrc"></a>.vimrc</h2><pre><code class="vim"><span class="comment">" Copyright 2019 XiaNing xianing@inetdev.cn https://www.inetdev.cn</span>
<span class="comment">"</span>
<span class="string">" Licensed under the Apache License, Version 2.0 (the "</span>License<span class="comment">");</span>
<span class="comment">" you may not use this file except in compliance with the License.</span>
<span class="comment">" You may obtain a copy of the License at</span>
<span class="comment">"</span>
<span class="comment">"     http://www.apache.org/licenses/LICENSE-2.0</span>
<span class="comment">"</span>
<span class="comment">" Unless required by applicable law or agreed to in writing, software</span>
<span class="string">" distributed under the License is distributed on an "</span>AS IS<span class="comment">" BASIS,</span>
<span class="comment">" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<span class="comment">" See the License for the specific language governing permissions and</span>
<span class="comment">" limitations under the License.</span>

<span class="keyword">let</span> mapleader = <span class="string">','</span>

nnoremap ; :
vnoremap ; :
<span class="keyword">nnoremap</span> <span class="symbol">&lt;f1&gt;</span> <span class="symbol">&lt;esc&gt;</span>
<span class="keyword">inoremap</span> <span class="symbol">&lt;f1&gt;</span> <span class="symbol">&lt;esc&gt;</span>
<span class="keyword">nnoremap</span> <span class="symbol">&lt;f2&gt;</span> :NERDTreeToggle<span class="symbol">&lt;cr&gt;</span>
<span class="keyword">nnoremap</span> <span class="symbol">&lt;f3&gt;</span> :TagbarToggle<span class="symbol">&lt;cr&gt;</span>
<span class="keyword">nnoremap</span> <span class="symbol">&lt;f4&gt;</span> :YcmGenerateConfig<span class="symbol">&lt;cr&gt;</span>:CCGenerateConfig<span class="symbol">&lt;cr&gt;</span>
<span class="keyword">nnoremap</span> <span class="symbol">&lt;c-l&gt;</span> :Autoformat<span class="symbol">&lt;cr&gt;</span>

<span class="keyword">nnoremap</span> <span class="symbol">&lt;leader&gt;</span>gl :YcmCompleter GoToDeclaration<span class="symbol">&lt;cr&gt;</span>
<span class="keyword">nnoremap</span> <span class="symbol">&lt;leader&gt;</span>gf :YcmCompleter GoToDefinition<span class="symbol">&lt;cr&gt;</span>

<span class="keyword">syntax</span> <span class="keyword">on</span>
<span class="keyword">filetype</span> <span class="keyword">on</span>
<span class="keyword">filetype</span> plugin <span class="built_in">indent</span> <span class="keyword">on</span>

<span class="keyword">set</span> cinoptions=&gt;s,e0,n0,f0,{<span class="number">0</span>,}<span class="number">0</span>,^<span class="number">0</span>,L-<span class="number">1</span>,:<span class="number">0</span>,=s,l0,b0,g0,hs,N0,E-s,<span class="keyword">ps</span>,<span class="keyword">ts</span>,<span class="keyword">is</span>,+s,c3,C0,/<span class="number">0</span>,(<span class="number">2</span>s,us,U0,w0,W0,k0,m0,j0,J0,)<span class="number">20</span>,*<span class="number">70</span>,#<span class="number">0</span>

<span class="keyword">set</span> <span class="keyword">number</span>
<span class="keyword">set</span> relativenumber
<span class="keyword">set</span> ruler
<span class="keyword">set</span> hlsearch
<span class="keyword">set</span> backspace=<span class="number">2</span>
<span class="keyword">set</span> laststatus=<span class="number">2</span>
<span class="keyword">set</span> encoding=utf-<span class="number">8</span>
<span class="keyword">set</span> nobackup

<span class="keyword">set</span> tabstop=<span class="number">2</span>
<span class="keyword">set</span> <span class="built_in">shiftwidth</span>=<span class="number">2</span>
<span class="keyword">set</span> softtabstop=<span class="number">2</span>
<span class="keyword">set</span> expandtab
<span class="keyword">set</span> fileformat=unix
<span class="keyword">set</span> encoding=utf-<span class="number">8</span>

<span class="keyword">set</span> t_Co=<span class="number">256</span>
<span class="keyword">set</span> <span class="keyword">history</span>=<span class="number">1024</span>
<span class="keyword">set</span> nocompatible
<span class="keyword">set</span> ignorecase
<span class="keyword">set</span> completeopt=longest,<span class="keyword">menu</span>

<span class="keyword">let</span> <span class="variable">g:NERDTreeWinPos</span> = <span class="string">'right'</span>
<span class="keyword">let</span> <span class="variable">g:NERDTreeWinSize</span> = <span class="number">35</span>
<span class="keyword">let</span> <span class="variable">g:NERDTreeDirArrowExpandable</span> = <span class="string">'+'</span>
<span class="keyword">let</span> <span class="variable">g:NERDTreeDirArrowCollapsible</span> = <span class="string">'-'</span>
<span class="keyword">let</span> <span class="variable">g:NERDTreeHighlightCursorline</span> = <span class="number">0</span>

<span class="keyword">let</span> <span class="variable">g:tagbar_ctags_bin</span> = <span class="string">'/usr/bin/ctags'</span>
<span class="keyword">let</span> <span class="variable">g:tagbar_iconchars</span> = [<span class="string">'+'</span>, <span class="string">'-'</span>]

<span class="keyword">let</span> <span class="variable">g:ycm_global_ycm_extra_conf</span> = <span class="string">'~/.ycm_extra_conf.py'</span>
<span class="keyword">let</span> <span class="variable">g:ycm_collect_identifiers_from_tag_files</span> = <span class="number">1</span>
<span class="keyword">let</span> <span class="variable">g:ycm_seed_identifiers_with_syntax</span> = <span class="number">1</span>
<span class="keyword">let</span> <span class="variable">g:cpp_member_variable_highlight</span> = <span class="number">1</span>
<span class="keyword">let</span> <span class="variable">g:ycm_confirm_extra_conf</span> = <span class="number">0</span>
<span class="keyword">let</span> <span class="variable">g:ycm_cache_omnifunc</span> = <span class="number">0</span>
<span class="keyword">let</span> <span class="variable">g:ycm_min_num_of_chars_for_completion</span> = <span class="number">1</span>
<span class="keyword">let</span> <span class="variable">g:ycm_show_diagnostics_ui</span> = <span class="number">0</span>
<span class="keyword">let</span> <span class="variable">g:ycm_complete_in_comments</span> = <span class="number">1</span>
<span class="keyword">let</span> <span class="variable">g:ycm_complete_in_strings</span> = <span class="number">1</span>
<span class="keyword">let</span> <span class="variable">g:ycm_server_python_interpreter</span> = <span class="string">'/usr/bin/python'</span>
<span class="keyword">let</span> <span class="variable">g:ycm_python_binary_path</span> = <span class="string">'/usr/bin/python3'</span>
<span class="keyword">let</span> <span class="variable">g:ycm_autoclose_preview_window_after_insertion</span> = <span class="number">1</span>
<span class="keyword">let</span> <span class="variable">g:ycm_collect_identifiers_from_comments_and_strings</span> = <span class="number">0</span>

<span class="keyword">let</span> <span class="variable">g:formatdef_linux</span> = <span class="string">'"astyle -A8 -s2 -N -xn -xc -xU -xt2 -p -xC80 -w -Y -xg -k3 -c"'</span>
<span class="keyword">let</span> <span class="variable">g:formatters_cpp</span> = [<span class="string">'linux'</span>]
<span class="keyword">let</span> <span class="variable">g:formatters_c</span> = [<span class="string">'linux'</span>]

<span class="keyword">let</span> <span class="variable">g:NERDSpaceDelims</span> = <span class="number">1</span>

<span class="keyword">if</span> &amp;diff
  <span class="keyword">let</span> <span class="variable">g:color_coded_enabled</span> = <span class="number">0</span>
<span class="keyword">endif</span>

<span class="keyword">call</span> plug#begin(<span class="string">'~/.vim/plugged'</span>)
Plug <span class="string">'scrooloose/nerdtree'</span>
Plug <span class="string">'scrooloose/nerdcommenter'</span>
Plug <span class="string">'jiangmiao/auto-pairs'</span>
Plug <span class="string">'majutsushi/tagbar'</span>
Plug <span class="string">'Valloric/YouCompleteMe'</span>
Plug <span class="string">'joker1007/vim-markdown-quote-syntax'</span>
Plug <span class="string">'Chiel92/vim-autoformat'</span>
Plug <span class="string">'kien/ctrlp.vim'</span>
Plug <span class="string">'rdnetto/YCM-Generator'</span>
Plug <span class="string">'xia-ning/color_coded'</span>
Plug <span class="string">'xia-ning/vim-colorscheme-dog'</span>
Plug <span class="string">'godlygeek/tabular'</span>
<span class="keyword">call</span> plug#end()

<span class="keyword">colorscheme</span> dog
<span class="keyword">hi</span> MatchParen ctermbg=White guibg=lightblue

autocm FileType <span class="keyword">python</span> <span class="keyword">setlocal</span> et <span class="keyword">sta</span> <span class="keyword">sw</span>=<span class="number">2</span> <span class="keyword">sts</span>=<span class="number">2</span></code></pre>

      
    </div>

    

    
    
    

    

    
      
    
    

    
      <div>
        




  



<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>XiaNing</li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    
    <a href="https://www.inetdev.cn/post/f767db5f.html" title="Vim配置C/C++语言开发环境">https://www.inetdev.cn/post/f767db5f.html</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！</li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Linux/" rel="tag"># Linux</a>
          
            <a href="/tags/C-C/" rel="tag"># C/C++</a>
          
            <a href="/tags/Vim/" rel="tag"># Vim</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/post/769324a.html" rel="next" title="Linux安装oh-my-zsh">
                <i class="fa fa-chevron-left"></i> Linux安装oh-my-zsh
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/post/2e8fe467.html" rel="prev" title="Python-Vim插件模板">
                Python-Vim插件模板 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="gitalk-container">
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/avatar.png" alt="XiaNing">
            
              <p class="site-author-name" itemprop="name">XiaNing</p>
              <div class="site-description motion-element" itemprop="description">这里放点东西比较和谐。</div>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">11</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                      <a href="/categories/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">15</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                      <a href="/tags/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">14</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                  
                    
                  
                  <a href="https://github.com/xia-ning" title="GitHub &rarr; https://github.com/xia-ning" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i></a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                  
                    
                  
                  <a href="mailto:xianing@inetdev.cn" title="E-Mail &rarr; mailto:xianing@inetdev.cn" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i></a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                  
                    
                  
                  <a href="https://weibo.com/showwcn" title="Weibo &rarr; https://weibo.com/showwcn" rel="noopener" target="_blank"><i class="fa fa-fw fa-weibo"></i></a>
                </span>
              
            </div>
          

          

          
          

          
            
          
          

        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#vim配置目录结构"><span class="nav-text">vim配置目录结构</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#vim主题"><span class="nav-text">vim主题</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#vimrc"><span class="nav-text">.vimrc</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>
  


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">XiaNing</span>

  

  
</div>


  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.8.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> v7.1.2</div>




        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="post-meta-divider">|</span>
  

  
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>














  
    
    
      
    
  
  <script color="128,128,128" opacity="0.5" zindex="-1" count="99" src="//cdn.jsdelivr.net/gh/theme-next/theme-next-canvas-nest@1/canvas-nest-nomobile.min.js"></script>











  



  
  <script src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script src="//cdn.jsdelivr.net/gh/theme-next/theme-next-reading-progress@1/reading_progress.min.js"></script>


  


  <script src="/js/utils.js?v=7.1.2"></script>

  <script src="/js/motion.js?v=7.1.2"></script>



  
  


  <script src="/js/affix.js?v=7.1.2"></script>

  <script src="/js/schemes/pisces.js?v=7.1.2"></script>



  
  <script src="/js/scrollspy.js?v=7.1.2"></script>
<script src="/js/post-details.js?v=7.1.2"></script>



  


  <script src="/js/next-boot.js?v=7.1.2"></script>


  

  

  

  


  
    

<script src="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>



  

<link rel="stylesheet" href="/css/gitalk.css">



<script src="//cdn.jsdelivr.net/npm/js-md5@0.7.3/src/md5.min.js"></script>

<script>
  var gitalk = new Gitalk({
    clientID: '9f137e86593cc25ee5a6',
    clientSecret: 'c399629b1b5cecd559e9f50744016bc76454cc4f',
    repo: 'xia-ning.github.io',
    owner: 'xia-ning',
    admin: ['xia-ning'],
    id: md5(location.pathname),
    
      language: 'zh-CN',
    
    distractionFreeMode: 'true'
  });
  gitalk.render('gitalk-container');
</script>

  


  
  <script>
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url).replace(/\/{2,}/g, '/');
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x"></i></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x"></i></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  

  

  
  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>


  

  

  

  

  

  

  

  

</body>
</html>
